package com.LeeCode;

/**
 * 存在连续三个奇数的数组
 */

public class Code1550 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 34, 3, 4, 5, 7, 23, 12};
        System.out.println(new Code1550().threeConsecutiveOdds(arr));
    }

    public boolean threeConsecutiveOdds(int[] arr) {
        if (arr.length < 3)
            return false;

        for (int i = 2; i < arr.length; i++) {
            if (arr[i] % 2 == 1 && arr[i - 1] % 2 == 1 && arr[i - 2] % 2 == 1)
                return true;
        }
        return false;
    }
}
